Repository navigation
feat(units): show a quantity with its unit label (#35490) - #37449
Conversation
#35490) A number field declaring unitConfig draws its unit beside the number in grid, list, form and detail, through one resolver in @object-ui/core and one formatter in @object-ui/fields. Standard codes take the platform's per-locale label and their organization's sys_standard_unit_setting row; organization codes take their sys_unit label and decimal places. The field's scale is the ceiling (ADR-0158 L4). A retired or unreadable unit shows the bare code. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CXM7nqtiQ3M9JqGAqL
…e zh-Hant (#35490) Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CXM7nqtiQ3M9JqGAqL
…35490) Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CXM7nqtiQ3M9JqGAqL
…35490) Apply the rulings on ADR-0158 Open item 6 and L2: - @objectstack/spec gains STANDARD_UNIT_NAMES, the English base name of every standard code, and standardUnitName (own-property, exact case). - platform-objects bundles serve each code's name per locale as messages.standardUnit<CODE>; English is copied from the spec base. - The UI reads app.messages.standardUnit<CODE> and falls back to the spec base; its own per-locale tables are removed. - A quantity rounds at render, half away from zero, at fixed width min(unit places, field scale); stored values, totals, exports, API and MCP stay exact. No marker. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CXM7nqtiQ3M9JqGAqL
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CXM7nqtiQ3M9JqGAqL
📓 Docs Drift CheckThis PR changes 2 package(s): 5 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 176 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 58db4ead191a0f528b47adbfe79e4756b86ff60c && git checkout 58db4ead191a0f528b47adbfe79e4756b86ff60c
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 4925039a7558d6477323eeef7b1b16d89da01cc3 37fca77eee7be2df4c6073dac7c5d9a628ca6552 && git checkout -B drift-repro 4925039a7558d6477323eeef7b1b16d89da01cc3 && git merge --no-ff 37fca77eee7be2df4c6073dac7c5d9a628ca6552
node scripts/docs-audit/affected-docs.mjs --json 4925039a7558d6477323eeef7b1b16d89da01cc3
|
…ns (#35490) Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CXM7nqtiQ3M9JqGAqL
…rm test (#35490) Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CXM7nqtiQ3M9JqGAqL
… the component-type gate (#35490) Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CXM7nqtiQ3M9JqGAqL
The number widget reads it, as it reads currencyConfig; the form-field channel census requires every key it reads to be declared. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CXM7nqtiQ3M9JqGAqL
|
repo:objectstack#5 · os-bill · session_01Utp6CbdHk3orAeensH6EzS Final head: Where the per-locale names are served (measured). The platform-objects translation bundles, in their flat ADR-0158 amendment text (for the ADR owner;
|
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract-review-claim: session_01Utp6CYtTDvfPQDzMbZnN5X · head 7b7017e · 2026-11-26T07:08Z |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract reviewServed-tier: Inputs read: card #35490 (body and all six comments), the PR body, the 44-file net diff against ① Derived judgments
② Semver levelClause-②: yes (widening) — accurate for
③ Boundary flags
④ Design judgment
Implementing files.
The ADR-0158 amendment text in 7185000835 against the code. Consistent on Open item 6, L1 / Open item 11, L2 and the follow-up item. Two wordings to tighten when the row is filed on #37245 (no row for this PR is there yet, which is expected before landing):
Other nits:
Findings open on this head: S1, S2, S3. No must-fix. Each should-fix earns a delta review of its fix; S2 and the PR-body half of S3 can close on the prose faces, S1 and the changeset half of S3 move the head. Implemented-by: VERDICT: PASS |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X 席位核对Head-sha:
|
…ield key in the changeset (#35490) Contract review S1 and S3: STANDARD_UNIT_NAMES' jsdoc names the single-segment key standardUnit<CODE>; the changeset ships @object-ui/types as minor with Metadata-protocol: added and names unitConfig on FormField/FormFieldSchema. The form-face comments say nothing there reads unitMode 'code' yet. Adds a negative half-rounding pin. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CXM7nqtiQ3M9JqGAqL
ADR-0158 Open item 8 (ruled A): a text field declaring unitMode 'code', and the unitField a record-mode quantity on the same form points at, draw UnitCodeField, a searchable picker of the organization's non-retired units and the standard codes, by name and limited to the declared unitDimension. It stores the code; read-only it shows the unit's name. @object-ui/core adds unitPickerOptions and the pointer helpers; the form stamps the pointer and hands the field its record. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CXM7nqtiQ3M9JqGAqL
…over (#37471) The form already reads its configs' .field stash (a ledgered reader); the core helper now takes the metadata alone, so the form-field channel census keeps one reader of that key per module. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CXM7nqtiQ3M9JqGAqL
…unit name exports (#35490) The PR declares Metadata-protocol: added. The level gate reads only packages/**/src, and spec's public surface grew by STANDARD_UNIT_NAMES and standardUnitName, so spec carries the minor beside @object-ui/types. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CXM7nqtiQ3M9JqGAqL
|
repo:objectstack#5 · os-bill · session_01Utp6CbdHk3orAeensH6EzS Final head: L1 findings, closed
ADR-0158 amendment text (for the ADR owner;
|
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract-review-claim: session_01Utp6CYtTDvfPQDzMbZnN5X · head 37fca77 · 2026-11-26T08:24Z |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract reviewServed-tier: Delta review of the record on ① Derived judgments
② Semver levelClause-②: yes (widening) — still accurate. The delta removes nothing.
③ Boundary flags
④ Design judgment
The picker.
The amendment text in 7186545236 against the code. Consistent on every line. N2: closed — Open item 10 now separates "read but empty" from "not read at all", and Open item 6 says the footer is unchanged. The new Open item 8 line matches the picker as built and correctly limits it to the form face. No must-fix, no should-fix. Nits, none blocking:
S1: closed Implemented-by: VERDICT: PASS |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X 席位核对Head-sha:
|
|
repo:objectstack#5 · os-bill · session_01Utp6CbdHk3orAeensH6EzS Landing · area o5-D · 2026-11-26T08:33Z · on L1 ACCEPT 7186657457 and delta contract review PASS 7186636273 (
State: ready + auto-merge now. Known overlap: PR #37436 (#36806) edits the same |
Keeps both extraFields entries (lockOperandFields and #37449's quantityUnitFields) in objectGridRowLoad.ts.
Requested by Bill · project thread
repo:objectstack#5 · os-bill · session_01Utp6CbdHk3orAeensH6EzS
Fixes #35490
Fixes #37471
Clause-②: yes (widening)
Metadata-protocol: added
What
A quantity (
unitConfigon anumberfield) now renders with its unit on every display face: the grid cell, the form (read-only and edited), and the detail row (DetailSection, the quick-look panel, RelatedList). A unit-codetextfield (unitMode: 'code') shows its unit's name (Open item 8 (A)).Choosing a unit (Open item 8, ruled A: 「有下拉」, Units of measure: unit picker for a unit-code field and a quantity's unit field (ADR-0158 Open item 8) #37471). In a form, a unit code field is a searchable picker (
UnitCodeField), never a typed box. That covers atextfield declaringunitMode: 'code'and theunitFieldarecordquantity on the same form points at; the form stamps that pointer (withUnitCodePointer) and hands the field its record. The picker lists the record's organization's non-retiredsys_unitrows, then every standard code, each by its translated name (spec fallback) and limited to the declaredunitDimension. It stores the code. Read-only, the field shows the unit's name, not the bare code.Authorable key (
Metadata-protocol: added).unitConfigis now declared on@object-ui/types'FormField/FormFieldSchema, by reference to the spec'sFieldSchema.unitConfig, besidecurrencyConfig, soobjectui validateaccepts it on a hand-authored form field.@object-ui/typesshipsminor(thescale/currencyConfigprecedent). The tolerant face now checks the key's value againstUnitConfigSchemawhere it passed as an unknown key before.Which unit. Fixed mode uses
unitConfig.unit. Record mode reads the row'sunitField. Grid, ListView and RelatedList add the unit column andorganization_idto their$selectwhen the unit column is not shown.Name. An org unit (
sys_unit, U3) shows itslabel. A standard code shows the platform's name for it in the reader's locale (L2, 2A): the spec English baseSTANDARD_UNIT_NAMES, and each platform bundle servesmessages.standardUnit<CODE>. The UI readsapp.messages.standardUnit<CODE>and falls back to the English base.Decimals. These come from the unit row (org unit
decimal_places, or thesys_standard_unit_settingrow for a standard code, OI10 (A)). The row is the one whoseorganization_idmatches the record's organization (note 7180167601). L4 holds: the display width ismin(unit places, field scale).Rounding (OI6, ruled A). The display rounds half away from zero (Intl
halfExpand) at a fixed width. The stored value, footer totals (summed exact, then formatted), exports, the API and MCP stay exact. No marker is shown.Bare code. A retired ("deleted") org unit, an unknown code, or a reader who may not read
sys_unit(an external member, comment 7030066814) gets the bare code, never an error.The rows are read once per data-source adapter for the session (the
homeAmountPreviewprecedent). Each table is read on its own, so a refusal of one leaves the other usable.Server-side home of the names (measured)
The platform-objects translation bundles, flat
messagesmap, with single-segment keysstandardUnit<CODE>. The keys are not dottedunits.standard.<CODE>becauseFileI18nAdapter.resolveKeysplits on.and walks the parts as nesting (the plugin-audit precedent). The console's served document lays bundles underapp, so the UI key isapp.messages.standardUnit<CODE>. English is copied from the spec base, never re-typed. Ten locales are translated, and a pin test holds every locale to exactly the 41 codes.Acceptance notes
skills/**fence).ObjectGridwith noSchemaRendererContext: there is no data source, so no unit rows are read. Codes show bare at the field's own width. This known limit is pinned ingridQuantityUnit-35490.test.tsx.1,235 kilogram.const extraFields = [...]line inui/packages/plugin-grid/src/objectGridRowLoad.ts: this PR appends...quantityUnitFields, and feat(spec,ui): a field can be read-only by hand at the console while writes keep it (uiReadonly / uiReadonlyWhen) #37436 inserts...lockOperandFields. Whichever lands second merges main and keeps both entries.Verification
standard-units18/18; platform-objects translations 613/613.check:api-surfacewas regenerated (2 added exports).check-i18n-bundles,check-i18n-stale-fillandcheck-i18n-walk-paritypass.check-published-readme-exportspasses.overlap-check: clean against main, feat(ui): retire the grid's staged edit model with its host interface #37437, feat(spec,ui): a field can be read-only by hand at the console while writes keep it (uiReadonly / uiReadonlyWhen) #37436 and feat(fields,plugins,platform-objects): a select option is coloured only when its author declared a colour #37427.🤖 Generated with Claude Code
https://claude.ai/code/session_01Utp6CXM7nqtiQ3M9JqGAqL